package app.server

import app.comet.Subscriber
import im.mange.shoreditch.hipster.{VersionedService, Step}
import scala.Option
import org.joda.time.LocalDateTime
import im.mange.shoreditch.engine.services.Service
import im.mange.shoreditch.engine.systems.System
import im.mange.shoreditch.engine.model.Test

case object Init
case class SystemsRequest(subscriber: Subscriber)
case class SystemsResponse(systems: List[System])
case class ServicesRequest(subscriber: Subscriber)
case class ServicesResponse(services: List[Service])
case class TestsRequest(subscriber: Subscriber)
case class TestsResponse(tests: List[Test])

//TODO: might be better if theese were testId, runId etc .. and ultimately make them case classes
case class TestContent(testId: String, name: String, steps: Seq[Step])
case class TestView(testId: String, subscriber: Subscriber)
case class ScheduleTestRun(testId: String, subscriber: Subscriber)
case class StopTestRun(testRunId: String, subscriber: Subscriber)
//TODO: a better name?
case class ValidatedTestRun(testId: String, testRunId: String, versionedServices: List[VersionedService])
case class StartedTestRun(testId: String, steps: Seq[Step], duration: Long, testRunId: String)
case class StoppedTestRun(testId: String, duration: Long, successful: Boolean, startedAt: Option[LocalDateTime], reason: Option[String])
case class UpdateTestRun(testId: String, step: Step, reasons: List[String], duration: Long)
